Added port support, and removed things from BASIC_DEVELOPMENT it does not yet support

This commit is contained in:
deadvey
2026-03-04 23:09:29 +00:00
parent beca477ff9
commit 43d0a020f7
6 changed files with 33 additions and 84 deletions

View File

@@ -1,17 +1,2 @@
$1 = "_________"
A = & $1
FOR X = 1 TO 9
FOR Y = 1 TO 9
PEEK B A
IF B = 95 THEN PRINT "_" ;
IF B = 88 THEN PRINT "X" ;
IF B = 79 THEN PRINT "O" ;
C = A % 3
IF C = 0 THEN PRINT " "
A = A + 1
NEXT Y
Z = X % 2
IF Z = 0 THEN PRINT "You are X"
IF Z = 1 THEN PRINT "You are O"
NEXT X
PORT OUT 80 5
END

View File

@@ -81,19 +81,6 @@ input $1
## Keywords
You can do this to get the MikeOS API version number:
```
x = VERSION
```
Or you can retrieve the lower word of the system clock like this:
```
x = TIMER
```
To get the current ink colour, use:
```
x = INK
```
## The editor
You can run your .BAS programs by using the BAS core util eg.
@@ -176,13 +163,6 @@ Get the position of the cursor. Example:
curspos a b
```
## DELETE
Removes a file from the disk. Returns 0 in the R variable if the operation was a success, 1 if the delete operation couldn't be completed, or 2 if the file doesn't exist. Example:
```
delete "myfile.txt"
```
## DO
Perform a loop until a condition is met (UNTIL or WHILE). You can also set up an infinite loop with LOOP ENDLESS at the end. Example:
@@ -205,10 +185,6 @@ else print "Goodbye"
Terminates execution of the BASIC program and hands control back to the operating system.
## FILES
Prints a list of files that are on the disk on the screen.
## FOR
Begins a loop, counting upwards using a variable. The loop must be finished with a NEXT instruction and the relevant variable. Example:
@@ -423,15 +399,6 @@ print hex x
```
In the first print command, the output is 109. In the second, the output is the ASCII character for 109 -- that is, 'm'. And in the third command, it shows the hexadecimal equivalent of 109.
## RAND
Generate a random integer number between two values (inclusive) and store it in a variable. Example:
```
Make X a random number between 50 and 2000
rand x 50 2000
```
## READ
Read data bytes from a label, first specifying the offset and a variable into which to read. For instance, in the following example we read a small program and poke it into memory locations 50000 to 50012. We then call that location to run the program:
@@ -453,14 +420,6 @@ mydata:
190 87 195 232 173 60 195 89 111 33 13 10 0
```
## RENAME
Renames one file to another. Literal strings and string variables are allowed. Afterwards, R contains 0 if the operation was a success, 1 if the file was not found, 2 if the write operation failed, or 3 if the target file already exists. Example:
```
$1 = "myfile.dat"
rename "oldfile.txt" $1
```
## RETURN
Switches execution back to the position of the prior GOSUB statement. See GOSUB above for more information. Example:
@@ -468,17 +427,6 @@ Switches execution back to the position of the prior GOSUB statement. See GOSUB
return
```
## SAVE
Saves data from memory to a file on the disk. The first parameter is the filename, the second the location in RAM where the data starts, and the third the number (in bytes) the amount of data to save. After execution, the R variable contains 1 if the file save operation failed (eg if it's a write-only medium), 2 if the file already exists, or 0 if it was successful. Examples:
```
save "myfile.txt" 40000 256
$1 = "myfile.txt"
x = 40000
y = 256
save $1 x y
```
## STRING

View File

@@ -354,12 +354,12 @@ disk_list_contents:
popa
ret
disk_file_list:
ret
disk_file_exists:
ret
disk_file_size:
ret
disk_file_list:
ret
disk_remove_file:
ret
disk_rename_file:

View File

@@ -1,4 +1,5 @@
; AX = key pressed
; Waits until key is pressed before returning
os_read_input:
mov ah, 11h ; BIOS call to check for key
int 16h ; Interrupt
@@ -12,6 +13,16 @@ os_read_input:
int 16h
ret
; AX = key pressed
; Returns straight away
keyboard_check_key:
xor ax,ax
mov ah, 11h ; BIOS call to check for key
int 16h ; Interrupt
jz .no_key
.no_key:
xor ax,ax
ret
; -------------------------------------------
; IN:
; AX = output address
@@ -23,11 +34,6 @@ keyboard_display_input:
mov ax, bx
mov bx,20
.loop:
jmp .check_key_pressed
jmp .loop
.check_key_pressed:
call os_read_input
@@ -43,7 +49,8 @@ keyboard_display_input:
dec bx
cmp bx, 0
jae .print_current_input ; Echo the user input back
je .enter_key ; Once the limit is reached just enter it
ja .print_current_input ; Echo the user input back
jmp .check_key_pressed
@@ -59,7 +66,7 @@ keyboard_display_input:
.backspace:
cmp bx, 20 ; Cannot backspace if the cursor is at the start
jb .move_cursor_back ; then .move_cursor_back
jmp .loop ; Else .loop
jmp .check_key_pressed ; Else check the next key
.move_cursor_back:
mov ah, 0Eh
@@ -73,7 +80,7 @@ keyboard_display_input:
inc bx
dec di
jmp .loop
jmp .check_key_pressed
.print_current_input: ; Echo back that character and return the key inputing
stosb
@@ -81,9 +88,9 @@ keyboard_display_input:
int 10h
jmp .check_key_pressed
keyboard_get_cursor_pos: ;TODO
keyboard_get_cursor_pos:
ret
keyboard_wait_for_key: ;TODO
keyboard_wait_for_key:
ret
keyboard_show_cursor:
ret
@@ -91,5 +98,3 @@ keyboard_hide_cursor:
ret
keyboard_move_cursor:
ret
keyboard_check_key:
ret

View File

@@ -1,7 +1,20 @@
; IN:
; DX = port address
; AL = byte
port_byte_out:
pusha
out dx,al
popa
ret
; -----------------------------------------
; IN:
; DX = port address
; OUT:
; AL = byte from port
port_byte_in:
in al, dx
ret
port_serial_enable:
ret
port_send_via_serial:

View File

@@ -331,7 +331,5 @@ string_lower_case: ; to lower case
popa
ret
string_input:
ret
string_print_2hex:
ret